#include "usr_inc.h"

/**
 * 按键键位:
 *     9  10      5  4
 *  6  7  8       1  2  3
 */
void StartKeyCmdDeal(void *argument)
{
    for (;;)
    {
        uint8_t key;
        xQueueReceive(keyCmdQueueHandle, &key, portMAX_DELAY);

        BattleCmdMsg_t battleCmd;
        AimMode_t mode;
        ChassisCmdMsg_t chassisCmd;
        if (key == 6)
        {
            battleCmd = BATTLE_PREPARE;
            xQueueSendToBack(battleCmdQueueHandle, &battleCmd, 1);
        }
        else if (key == 8)
        {
            battleCmd = BATTLE_GO;
            xQueueSendToBack(battleCmdQueueHandle, &battleCmd, 1);
        }
        else if (key == 1)
        {
            mode = AIM_HOOP;
            xQueueSendToBack(aimModeQueueHandle, &mode, 1);
        }
        else if (key == 2)
        {
            mode = AIM_R2;
            // xQueueSendToBack(aimModeQueueHandle, &mode, 1);
        }
        else if (key == 4)
        {
            battleCmd = BATTLE_SHOOT;
            xQueueSendToBack(battleCmdQueueHandle, &battleCmd, 1);
        }
        else if (key == 3)
        {
            battleCmd = BATTLE_RESET;
            xQueueSendToBack(battleCmdQueueHandle, &battleCmd, 1);
        }
        else if (key == 9)
        {
            chassisCmd = CHASSIS_CONF_JOY;
            xQueueSendToBack(chassisCmdQueueHandle, &chassisCmd, 1);
        }
    }
}
